{include file="public/header" /}
<span class="layui-breadcrumb">
  <a href="javascript:;">产品</a>
  <a><cite>列表</cite></a>
</span>
<div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body">
        <div class="layui-form">

          <div class="layui-form-item" style='margin-top:20px'>
            <div class="layui-inline">
              <label class="layui-form-label">产品名称</label>
              <div class="layui-input-inline">
                <input type="text" class="layui-input" name='cname' placeholder="请输入产品名称" >
              </div>
            </div>
            <div class="layui-inline">
              <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="sear()">查询</button>
              <a href="{:url('Product/index')}?nav=classify-productlist" class="layui-btn layui-btn-sm layui-btn-danger">清空</a>
            </div>
          </div>

          <table class="layui-hide" id="test" lay-filter="test"></table>

        </div>

      </div>  
    </div>
</div>

{include file="/public/footer" /}
<script>
var table

layui.use('table', function(){
 table = layui.table;
  
  table.render({
    elem: '#test'
    ,url:'/admin/Product/get_data/'
    ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
    ,cols: [[
      {field:'Product_Number', title:'产品型号'}
      ,{fixed: 'right', title:'操作',templet: function(res){ 
          var str="<a href='{:url('Product/des')}?nav=classify-classifylist&y=zh&id="+res.id+"' class='layui-btn layui-btn-primary layui-btn-xs' target='_blank'>中文文章</a>";
            str+="<a href='{:url('Product/des')}?nav=classify-classifylist&y=en&id="+res.id+"' class='layui-btn layui-btn-primary layui-btn-xs' target='_blank'>英文文章</a>";    
            str+="<a href='{:url('Product/getseo')}?nav=classify-classifylist&p="+res.URL_Product+"&id="+res.id+"' class='layui-btn layui-btn-primary layui-btn-xs' target='_blank'>seo</a>";    
        return str;  
      }}
    ]]

    ,page: true
    
  });
});

  /*查询*/
  function sear(){
    var cname=$.trim($("input[name='cname']").val());
    if(cname == '') {return false;}

    table.reload('test', {
      url: '/admin/Product/get_data/',
      where: { //设定异步数据接口的额外参数，任意设
          'sear': cname 
      },
    }); 
  }
 

</script>
